FROM artifactory.dep.devops.cmit.cloud:20101/tools/base-images/golang:alpine AS builder
ENV GO111MODULE on
ENV GOPROXY http://artifactory.dep.devops.cmit.cloud:20100/artifactory/api/go/go
WORKDIR /build
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o server .

FROM artifactory.dep.devops.cmit.cloud:20101/tools/base-images/alpine:3.14 AS final
WORKDIR /app
COPY --from=builder /build/server /app/
COPY --from=builder /build/templates/ /app/templates/
COPY --from=builder /build/images /app/images/
EXPOSE 8080
ENTRYPOINT ["/app/server"]